home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / commontp.zip / COMMON.PAS < prev    next >
Pascal/Delphi Source File  |  1990-06-23  |  18KB  |  898 lines

  1. unit common;
  2.  
  3. {This unit is based on Wayne Bell's realease of common.pas for WWIV 4.00
  4.  and is now compatible with 5.0 and 5.5.  There are a few modifications
  5.  in this version.
  6.  
  7.   1. It supports the modem and needs the Unit IBMCOM to work.
  8.  
  9.   2. It support several BBS types which are:
  10.       Wildcat!
  11.       WWIV
  12.       DOOR.SYS
  13.       Spitfire
  14.  
  15.   3. Has a SETUP function to set up the modem and such.
  16.  
  17.   4. Has a status line called SLINE that prints a line of infomation at
  18.      the bottom of the screen.
  19.  
  20.   I hold no rights to this or any changes I made.  The only reason I did
  21.   this is so that some of the excellent on-liners out there can be used
  22.   on not onlt WWIV but other boards, and alos so they can be updated to
  23.   later version of TP.  Hope to see many good on-liners on other boards
  24.   then WWIV.
  25.  }
  26.  
  27. interface
  28.  
  29. CONST strlen=160;
  30.  
  31. TYPE strr=string[strlen];
  32.      userrec=record
  33.                name:string[25];
  34.                realname:string[14];
  35.                laston:string[10];
  36.                linelen:byte;
  37.                pagelen:byte;
  38.                sl:byte;
  39.                age:byte;
  40.                sex:char;
  41.                callsign:string[8];
  42.                gold:real;
  43.              end;
  44.  
  45. var
  46.     sysopf:text{[1024]};
  47.     sysopffn:string[80];
  48.     gfilespath,datapath:string[80];
  49.     usernum:integer;
  50.     incom,okansi,cs,so,hangup,local:boolean;
  51.     timeon,timeleft:real;
  52.     thisuser:userrec;
  53.  
  54. procedure pnt(c:char);
  55. function timer:real;
  56. function nsl:real;
  57. function sysop1:boolean;
  58. function sysop:boolean;
  59. procedure sl1(i:strr);
  60. procedure sysoplog(i:strr);
  61. function tch(i:strr):strr;
  62. function time:strr;
  63. function date:strr;
  64. function value(I:strr):integer;
  65. function cstr(i:integer):strr;
  66. function nam:strr;
  67. function leapyear(yr:integer):boolean;
  68. function days(mo,yr:integer):integer;
  69. function daycount(mo,yr:integer):integer;
  70. function daynum(dt:strr):integer;
  71. function dat:strr;
  72. procedure checkhangup;
  73. procedure ansic(c:integer);
  74. procedure sdc;
  75. procedure pausescr;
  76. procedure prompt(i:strr);
  77. procedure print(i:strr);
  78. procedure nl;
  79. procedure prt(i:strr);
  80. procedure ynq(i:strr);
  81. procedure mpl(c:integer);
  82. procedure tleft;
  83. function empty:boolean;
  84. function inkey:char;
  85. procedure getkey(var c:char);
  86. procedure cls;
  87. function yn:boolean;
  88. procedure input1(var i:strr; ml:integer; tf:boolean);
  89. procedure input(var i:strr; ml:integer);
  90. procedure inputl(var i:strr; ml:integer);
  91. procedure onek(var c:char; ch:strr);
  92. procedure wkey(var abort,next:boolean);
  93. function ctim(rl:real):strr;
  94. function tlef:strr;
  95. function cstrr(rl:real; base:integer):strr;
  96. procedure printa1(i:strr; var abort,next:boolean);
  97. procedure printa(i:strr; var abort,next:boolean);
  98. procedure printacr(i:strr; var abort,next:boolean);
  99. procedure pfl(fn:strr; var abort:boolean; cr:boolean);
  100. procedure printfile(fn:strr);
  101. procedure iport;
  102. procedure return;
  103. procedure setup;
  104. procedure sline (thisuser:userrec);
  105.  
  106. implementation
  107.  
  108. uses crt,dos,ibmcom;
  109.  
  110. var
  111.  rp:registers;
  112.  
  113. procedure pnt;
  114. begin
  115.  if not(local) then
  116.   com_tx(c);
  117. end;
  118.  
  119. function timer;
  120. var reg:registers;
  121.     h,m,s,t:real;
  122. begin
  123.   reg.ax:=44*256;
  124.   msdos(dos.registers(reg));
  125.   h:=(reg.cx div 256);
  126.   m:=(reg.cx mod 256);
  127.   s:=(reg.dx div 256);
  128.   t:=(reg.dx mod 256);
  129.   timer:=h*3600+m*60+s+t/100;
  130. end;
  131.  
  132. function nsl;
  133. begin
  134.   if timer<timeon then
  135.     timeon:=timeon-24.0*3600.0;
  136.   nsl:=timeleft-(timer-timeon);
  137. end;
  138.  
  139. function sysop1;
  140. begin
  141.   if (mem[0:1047] and 16)=0 then sysop1:=false else sysop1:=true;
  142. end;
  143.  
  144. function sysop;
  145. begin
  146.   sysop:=sysop1;
  147. end;
  148.  
  149. procedure sl1;
  150. begin
  151.   writeln(sysopf,i);
  152. end;
  153.  
  154. procedure sysoplog;
  155. begin
  156.   if (not so) or incom then
  157.     sl1('   '+i);
  158. end;
  159.  
  160. function tch;
  161. begin
  162.   if length(i)>2 then i:=copy(i,length(i)-1,2) else
  163.     if length(i)=1 then i:='0'+i;
  164.   tch:=i;
  165. end;
  166.  
  167. function time;
  168. var reg:registers;
  169.     h,m,s:string[4];
  170. begin
  171.   reg.ax:=$2c00; intr($21,dos.registers(reg));
  172.   str(reg.cx shr 8,h); str(reg.cx mod 256,m); str(reg.dx shr 8,s);
  173.   time:=tch(h)+':'+tch(m)+':'+tch(s);
  174. end;
  175.  
  176. function date;
  177. var reg:registers;
  178.     m,d,y:string[4];
  179. begin
  180.   reg.ax:=$2a00; msdos(Dos.Registers(reg)); str(reg.cx,y); str(reg.dx mod 256,d);
  181.   str(reg.dx shr 8,m);
  182.   date:=tch(m)+'/'+tch(d)+'/'+tch(y);
  183. end;
  184.  
  185. function value;
  186. var n,n1:integer;
  187. begin
  188.   val(i,n,n1);
  189.   if n1<>0 then begin
  190.     i:=copy(i,1,n1-1);
  191.     val(i,n,n1)
  192.   end;
  193.   value:=n;
  194.   if i='' then value:=0;
  195. end;
  196.  
  197. function cstr;
  198. var c:strr;
  199. begin
  200.   str(i,c); cstr:=c;
  201. end;
  202.  
  203. function nam;
  204. var s:strr; i:integer; tf:boolean;
  205. begin
  206.   s:=thisuser.name;
  207.   tf:=true;
  208.   for i:=1 to length(s) do
  209.     if s[i]<'A' then
  210.       tf:=true
  211.     else begin
  212.       if (s[i]<='Z') and not tf then
  213.         s[i]:=chr(ord(s[i])+32);
  214.       tf:=false;
  215.     end;
  216.   nam:=s+' #'+cstr(usernum);
  217. end;
  218.  
  219. function leapyear;
  220. begin
  221.   leapyear:=(yr mod 4=0) and ((yr mod 100<>0) or (yr mod 400=0));
  222. end;
  223.  
  224. function days;
  225. var d:integer;
  226. begin
  227.   d:=value(copy('312831303130313130313031',1+(mo-1)*2,2));
  228.   if (mo=2) and leapyear(yr) then d:=d+1;
  229.   days:=d;
  230. end;
  231.  
  232. function daycount;
  233. var m,t:integer;
  234. begin
  235.   t:=0;
  236.   for m:=1 to (mo-1) do t:=t+days(m,yr);
  237.   daycount:=t;
  238. end;
  239.  
  240. function daynum;
  241. var d,m,y,t,c:integer;
  242. begin
  243.   t:=0;
  244.   m:=value(copy(dt,1,2));
  245.   d:=value(copy(dt,4,2));
  246.   y:=value(copy(dt,7,2))+1900;
  247.   for c:=1985 to y-1 do
  248.     if leapyear(c) then t:=t+366 else t:=t+365;
  249.   t:=t+daycount(m,y)+(d-1);
  250.   daynum:=t;
  251.   if y<1985 then daynum:=0;
  252. end;
  253.  
  254. function dat;
  255. var ap,x,y:strr; i:integer;
  256. begin
  257.   case daynum(date) mod 7 of
  258.     0:x:='Tue';
  259.     1:x:='Wed';
  260.     2:x:='Thu';
  261.     3:x:='Fri';
  262.     4:x:='Sat';
  263.     5:x:='Sun';
  264.     6:x:='Mon';
  265.   end;
  266.   case value(copy(date,1,2)) of
  267.     1:y:='Jan';
  268.     2:y:='Feb';
  269.     3:y:='Mar';
  270.     4:y:='Apr';
  271.     5:y:='May';
  272.     6:y:='Jun';
  273.     7:y:='Jul';
  274.     8:y:='Aug';
  275.     9:y:='Sep';
  276.     10:y:='Oct';
  277.     11:y:='Nov';
  278.     12:y:='Dec';
  279.   end;
  280.   x:=x+' '+y+' '+copy(date,4,2)+', '+cstr(1900+value(copy(date,7,2)));
  281.   y:=time; i:=value(copy(y,1,2));
  282.   if i>11 then ap:='pm' else ap:='am';
  283.   if i>12 then i:=i-12;
  284.   if i=0 then i:=12;
  285.   dat:=cstr(i)+copy(y,3,3)+' '+ap+'  '+x;
  286. end;
  287.  
  288. procedure checkhangup;
  289. begin
  290.  if hangup or (not(com_carrier)) then
  291.   if not (local) then
  292.    hangup := true;
  293. end;
  294.  
  295. procedure ansic;
  296. var f,b:byte;
  297.     fs,bs:strr;
  298. begin
  299.  if c = 0 then
  300.   c:=1;
  301.  b := 40;
  302.  case c of
  303.   1: f := 36;
  304.   2: f := 33;
  305.   3: f := 35;
  306.   4: begin
  307.       f := 37;
  308.       b := 44;
  309.      end;
  310.   5: f := 32;
  311.   6: f := 31;
  312.   7: f := 34;
  313.   8: f := 34;
  314.   9: f := 34;
  315.  end;
  316.  textbackground (b-40);
  317.  textcolor (f-30);
  318.  fs := cstr(f);
  319.  bs := cstr(b);
  320.  if okansi then begin
  321.   pnt(#27); pnt('['); pnt(fs[1]); pnt(fs[2]);
  322.   pnt(';'); pnt(bs[1]); pnt(bs[2]); pnt('m');
  323.  end;
  324. end;
  325.  
  326. procedure sdc;
  327. begin
  328.   ansic(0);
  329. end;
  330.  
  331.  
  332. procedure pausescr;
  333. var i:integer; cc:char;
  334. begin
  335.   ansic(3); prompt('[PAUSE]'); ansic(0);
  336.   getkey(cc);
  337.   for i:=1 to 7 do
  338.     prompt(#8+' '+#8);
  339. end;
  340.  
  341. procedure prompt;
  342. var c:integer; cc:char;
  343. begin
  344.  c := 0;
  345.  checkhangup;
  346.  if (not hangup) then
  347.   repeat
  348.    c := c+1;
  349.    if (i[c]=#10) then
  350.      ansic(0);
  351.    if not(i[c]=#3) then begin
  352.     write(i[c]);
  353.     pnt(i[c]);
  354.    end
  355.    else begin
  356.     if (i[c+1] in ['0'..'9']) then begin
  357.      c := c + 1;
  358.      ansic(value(i[c]));
  359.      end
  360.     else begin
  361.      ansic(0);
  362.      c := c + 1;
  363.     end;
  364.    end;
  365.   until c = length(i);
  366. end;
  367.  
  368. procedure print;
  369. begin
  370.   prompt(i+chr(13)+chr(10))
  371. end;
  372.  
  373. procedure nl;
  374. begin
  375.   prompt(chr(13)+chr(10))
  376. end;
  377.  
  378. procedure prt;
  379. begin
  380.   ansic(4); prompt(i); ansic(0);
  381. end;
  382.  
  383. procedure ynq;
  384. begin
  385.   ansic(7); prompt(i);
  386. end;
  387.  
  388. procedure mpl;
  389. var n:integer; i:strr;
  390. begin
  391.   if okansi then begin
  392.     ansic(6);
  393.     i:='';
  394.     for n:=1 to c do i:=i+' ';
  395.     prompt(i);
  396.     prompt(#27+'['+cstr(c)+'D');
  397.   end;
  398. end;
  399.  
  400. procedure tleft;
  401. var x,y:integer;
  402. begin
  403.   if timer<timeon then timeon:=timeon-24.0*60*60;
  404.   if (nsl<0) then begin
  405.     nl;
  406.     print('Time expired.');
  407.     hangup:=true;
  408.   end;
  409.   checkhangup;
  410. end;
  411.  
  412.  
  413. function empty;
  414. begin
  415.  empty := true;
  416.  if not (local) then
  417.   empty := com_rx_empty;
  418. end;
  419.  
  420. function inkey;
  421. begin
  422.  inkey := #0;
  423.  if not (local) then
  424.   inkey := com_rx
  425.  else
  426.   if keypressed then
  427.    inkey := readkey;
  428. end;
  429.  
  430.  
  431. procedure getkey;
  432. var
  433.  r:real;
  434. begin
  435.  r := timer;
  436.  c := #0;
  437.  repeat
  438.   checkhangup;
  439.   if not (local) then
  440.    if not(empty) then
  441.     c:= com_rx;
  442.   if keypressed and (not(c<>#0)) then
  443.    c := readkey;
  444.   if hangup or ((timer-r)>300.00) then
  445.    hangup := true;
  446.  until (c <> #0) or hangup;
  447. end;
  448.  
  449. procedure cls;
  450. begin
  451.   clrscr;
  452.   pnt (chr(12));
  453. end;
  454.  
  455.  
  456. function yn;
  457. var c:char;
  458. begin
  459.   if not hangup then begin
  460.     ansic(3);
  461.     repeat
  462.       getkey(c);
  463.       c:=upcase(c);
  464.     until (c='Y') or (c='N') or (c=chr(13)) or hangup;
  465.     if c='Y' then begin print('Yes'); yn:=true; end else begin print('No'); yn:=false; end;
  466.     if hangup then yn:=false;
  467.   end;
  468. end;
  469.  
  470. procedure input1;
  471. var cp:integer;
  472.     c:char;
  473.     r:real;
  474. begin
  475.  checkhangup;
  476.  if not hangup then begin
  477.   r:=timer;
  478.   cp:=1;
  479.   repeat
  480.     getkey(c);
  481.     if c=#1 then r:=timer;
  482.     if not tf then c:=upcase(c);
  483.     if (c>=' ') and (c<chr(127)) then
  484.       if cp<=ml then begin
  485.        i[cp]:=c;
  486.        cp:=cp+1;
  487.        write(c);
  488.        pnt(c);
  489.     end else else case ord(c) of
  490.       8:if cp>1 then begin
  491.                c:=chr(8);
  492.                write(#8#32#8);
  493.                pnt(#8); pnt (#32); pnt(#8);
  494.                cp:=cp-1;
  495.              end;
  496.       21,24:while cp<>1 do begin
  497.                cp:=cp-1;
  498.                write(#8#32#8);
  499.                pnt(#8); pnt (#32); pnt(#8);
  500.              end;
  501.     end;
  502.     if (timer-r)>300.0 then hangup:=true;
  503.   until (c=#13) or (c=#14) or hangup;
  504.   i[0]:=chr(cp-1);
  505.   nl;
  506.  end;
  507. end;
  508.  
  509. procedure input;
  510. begin
  511.   input1(i,ml,false);
  512. end;
  513.  
  514.  
  515. procedure inputl;
  516. begin
  517.   input1(i,ml,true);
  518. end;
  519.  
  520. procedure onek;
  521. begin
  522.   repeat
  523.     getkey(c);
  524.     c:=upcase(c);
  525.   until (pos(c,ch)>0) or hangup;
  526.   if hangup then c:=ch[1];
  527.   print(''+c);
  528. end;
  529.  
  530.  
  531.  procedure wkey;
  532.  var cc:char;
  533.  begin
  534.     while not (empty or hangup or abort) do begin
  535.       getkey(cc);
  536.       if (cc=' ') or (cc=chr(3)) or (cc=chr(24)) or (cc=chr(11)) then
  537.         abort:=true;
  538.       if (cc=chr(14)) then begin abort:=true; next:=true; end;
  539.       if (cc=chr(19)) or (cc='P') or (cc='p') then begin
  540.         getkey(cc);
  541.       end;
  542.     end;
  543.  end;
  544.  
  545. function ctim;
  546. var h,m,s:strr;
  547. begin
  548.   s:=tch(cstr(trunc(rl-int(rl/60.0)*60.0)));
  549.   m:=tch(cstr(trunc(int(rl/60.0)-int(rl/3600.0)*60.0)));
  550.   h:=cstr(trunc(rl/3600.0));
  551.   if length(h)=1 then h:='0'+h;
  552.   ctim:=h+':'+m+':'+s;
  553. end;
  554.  
  555. function tlef;
  556. begin
  557.   tlef:=ctim(nsl);
  558. end;
  559.  
  560. function cstrr;
  561. var c1,c2,c3:integer; i:strr; r1,r2:real;
  562. begin
  563.  if rl<=0.0 then cstrr:='0' else begin
  564.   r1:=ln(rl)/ln(1.0*base);
  565.   r2:=exp(ln(1.0*base)*(trunc(r1)));
  566.   i:='';
  567.   while (r2>0.999) do begin
  568.     c1:=trunc(rl/r2);
  569.     i:=i+copy('0123456789ABCDEF',c1+1,1);
  570.     rl:=rl-c1*r2;
  571.     r2:=r2/(1.0*base);
  572.   end;
  573.   cstrr:=i;
  574.  end;
  575. end;
  576.  
  577.  
  578. procedure printa1;
  579. var c:integer;
  580. begin
  581.  checkhangup;
  582.  if not hangup then begin
  583.   abort:=false; next:=false; c:=1;
  584.   if not empty then wkey(abort,next);
  585.   while (not abort) and (c-1<length(i)) and (not hangup) do begin
  586.     checkhangup;
  587.     if i[c]=#3 then
  588.       if i[c+1] in ['0'..'9'] then
  589.         if okansi then
  590.           ansic(ord(i[c+1]));
  591.     if not empty then wkey(abort,next);
  592.     if i[c]=#3 then
  593.       c:=c+1
  594.     else
  595.       write(i[c]);
  596.       pnt(i[c]);
  597.     c:=c+1;
  598.   end;
  599.  end else abort:=true;
  600. end;
  601.  
  602. procedure printa;
  603. var s:strr; p,op,rp,rop,nca:integer; crend:boolean;
  604. begin
  605.   abort:=false;
  606.   crend:=(i[length(i)]=#1) and (i[length(i)-1]<>#3);
  607.   if crend then i:=copy(i,1,length(i)-1);
  608.   wkey(abort,next);
  609.   if i='' then nl;
  610.   while (i<>'') and (not abort) and (not hangup) do begin
  611.     rp:=0; nca:=thisuser.linelen-wherex-1; p:=0;
  612.     while (rp<nca) and (p<length(i)) do begin
  613.       if i[p+1]=#8 then rp:=rp-1 else
  614.         if i[p+1]=#3 then
  615.           p:=p+1
  616.         else
  617.           if (i[p+1]<>#10) then rp:=rp+1;
  618.       p:=p+1;
  619.     end;
  620.     op:=p; rop:=rp;
  621.     if (rp>=nca) and (p<length(i)) then begin
  622.       while ((not (i[p] in [' ',#8,#10])) or (i[p-1]=#3)) and (p>1) do begin
  623.         rp:=rp-1; p:=p-1;
  624.       end;
  625.       if p=1 then
  626.         if not (i[1] in [' ',#8,#10]) then begin rp:=rp-1; p:=p-1; end;
  627.     end;
  628.     if abs(rop-rp)>=(thisuser.linelen div 2) then p:=op;
  629.     s:=copy(i,1,p); delete(i,1,p);
  630.     if (s[length(s)]=' ') then s[0]:=pred(s[0]);
  631.     printa1(s,abort,next);
  632.     if ((i='') and crend) or (i<>'') or abort then
  633.       nl
  634.     else
  635.       printa1(' ',abort,next);
  636.   end;
  637. end;
  638.  
  639. procedure printacr;
  640. begin
  641.  if not abort then
  642.   if i[length(i)]=#1 then
  643.     printa(i,abort,next)
  644.   else
  645.     printa(i+#1,abort,next);
  646. end;
  647.  
  648. procedure pfl;
  649. var fil:text;
  650.     i:strr;
  651.     next:boolean;
  652.     n:integer;
  653. begin
  654.     n := 0;
  655.     if not hangup then begin
  656.       assign(fil,fn);
  657.       {$I-} reset(fil); {$I+}
  658.       if ioresult<>0 then print('File not found.') else begin
  659.         abort:=false;
  660.         while not eof(fil) and (not abort) and (not hangup) do begin
  661.           readln(fil,i);
  662.           n := n + 1;
  663.           if cr then
  664.             printacr(i,abort,next)
  665.           else
  666.             printa(i,abort,next);
  667.           if n = (thisuser.pagelen - 1) then begin
  668.            pausescr;
  669.            n := 0;
  670.           end;
  671.         end;
  672.         close(fil);
  673.       end;
  674.       nl;nl;
  675.     end;
  676. end;
  677.  
  678. procedure printfile;
  679. var abort:boolean;
  680. begin
  681.   pfl(fn,abort,true);
  682. end;
  683.  
  684. procedure iport;
  685. var f:text;
  686.     i:strr;
  687.     n:integer;
  688. begin
  689.  if paramstr(1) = '-4' then begin
  690.   assign(f,paramstr(2));
  691.   {$I-} reset(f); {$I+}
  692.   if (ioresult=0) then begin
  693.     readln(f,usernum);
  694.     readln(f,thisuser.name);
  695.     readln(f,thisuser.realname);
  696.     readln(f,thisuser.callsign);
  697.     readln(f,thisuser.age);
  698.     readln(f,thisuser.sex);
  699.     readln(f,thisuser.gold);
  700.     readln(f,thisuser.laston);
  701.     readln(f,thisuser.linelen);
  702.     readln(f,thisuser.pagelen);
  703.     readln(f,thisuser.sl);
  704.     readln(f,n);
  705.     cs:=(n=1);
  706.     readln(f,n);
  707.     so:=(n=1);
  708.     readln(f,n);
  709.     okansi:=(n=1);
  710.     readln(f,n);
  711.     incom:=(n=1);
  712.     readln(f,timeleft);
  713.     readln(f,gfilespath);
  714.     readln(f,datapath);
  715.     readln(f,i);
  716.     close(f);
  717.     sysopffn:=gfilespath+i;
  718.   end else begin
  719.     writeln('Parameter file not found.');
  720.     halt;
  721.   end;
  722.   hangup:=false;
  723.   timeon:=timer;
  724.  end;
  725.  if paramstr(1) = '-w' then begin
  726.   assign(f,paramstr(2));
  727.   {$I-} reset(f); {$I+}
  728.   if (ioresult=0) then begin
  729.     readln(f,thisuser.name);
  730.     readln (f,i);
  731.     readln (f,i);
  732.     readln (f,thisuser.sl);
  733.     readln (f,i);
  734.     readln (f,i);
  735.     if i = 'COLOR' then
  736.      okansi := true
  737.     else
  738.      okansi := false;
  739.     readln(f,i);
  740.     readln(f,usernum);
  741.     readln(f,i);
  742.     readln(f,i);
  743.     readln(f,i);
  744.     readln(f,i);
  745.     readln(f,i);
  746.     readln(f,i);
  747.     readln(f,i);
  748.     readln(f,i);
  749.     readln(f,i);
  750.     readln(f,i);
  751.     readln(f,i);
  752.     readln(f,i);
  753.     readln(f,i);
  754.     readln(f,i);
  755.     readln(f,thisuser.pagelen);
  756.     thisuser.linelen := 80;
  757.     close (f);
  758.   end else begin
  759.     writeln('Parameter file not found.');
  760.     halt;
  761.   end;
  762.   hangup:=false;
  763.   timeon:=timer;
  764.  end;
  765.  if paramstr(1) = '-d' then begin
  766.   assign(f,paramstr(2));
  767.   {$I-} reset(f); {$I+}
  768.   if (ioresult=0) then begin
  769.     readln(f,i);
  770.     readln(f,i);
  771.     readln(f,i);
  772.     readln(f,i);
  773.     readln(f,i);
  774.     readln(f,i);
  775.     readln(f,i);
  776.     readln(f,i);
  777.     readln(f,i);
  778.     readln(f,thisuser.name);
  779.     readln(f,i);
  780.     readln(f,i);
  781.     readln(f,i);
  782.     readln(f,i);
  783.     readln(f,thisuser.sl);
  784.     readln(f,i);
  785.     if i = '1' then
  786.      okansi := true
  787.     else
  788.      okansi := false;
  789.     readln(f,i);
  790.     readln(f,i);
  791.     readln(f,i);
  792.     readln(f,i);
  793.     readln(f,thisuser.pagelen);
  794.     readln(f,i);
  795.     readln(f,i);
  796.     readln(f,i);
  797.     readln(f,i);
  798.     readln(f,usernum);
  799.     thisuser.linelen := 80;
  800.     close (f);
  801.   end else begin
  802.     writeln('Parameter file not found.');
  803.     halt;
  804.   end;
  805.   hangup:=false;
  806.   timeon:=timer;
  807.  end;
  808.  if paramstr(1) = '-s' then begin
  809.   assign(f,paramstr(2));
  810.   {$I-} reset(f); {$I+}
  811.   if (ioresult=0) then begin
  812.     readln(f,usernum);
  813.     readln(f,thisuser.name);
  814.     readln(f,i);
  815.     readln(f,i);
  816.     readln(f,i);
  817.     readln(f,i);
  818.     readln(f,i);
  819.     readln(f,i);
  820.     readln(f,i);
  821.     if i = 'COLOR' then
  822.      okansi := true
  823.     else
  824.      okansi := false;
  825.     readln(f,thisuser.sl);
  826.     thisuser.pagelen := 25;
  827.     thisuser.linelen := 80;
  828.     close (f);
  829.   end else begin
  830.     writeln('Parameter file not found.');
  831.     halt;
  832.   end;
  833.   hangup:=false;
  834.   timeon:=timer;
  835.  end;
  836.  if not ((paramstr(1) = '-4') or (paramstr(1) = '-w') or (paramstr(1) = '-d') or
  837.   (paramstr(1) = '-s')) then begin
  838.   print ('6Error!!');
  839.   halt;
  840.  end;
  841. end;
  842.  
  843. procedure return;
  844. begin
  845.   halt;
  846. end;
  847.  
  848. procedure setup;
  849. var
  850.  error:word;
  851. begin
  852.  hangup := false;
  853.  com_install(value(paramstr(3)),error);
  854.  if error <> 0 then
  855.   local := true;
  856.  local := not(com_carrier);
  857.  checkhangup;
  858.  if (error = 1) or (error = 2) then
  859.   hangup := true;
  860. end;
  861.  
  862. procedure sline;
  863. var
  864.  ox,oy:byte;
  865.  i :integer;
  866.  
  867. begin
  868.  ox := wherex;
  869.  oy := wherey;
  870.  window (1,1,80,25);
  871.  gotoxy (1,25);
  872.  textbackground (5);
  873.  textcolor (14);
  874.  write ('ANSI: ');
  875.  if okansi then
  876.   write ('TRUE   ')
  877.  else
  878.   write ('FALSE  ');
  879.  write ('LOCAL: ');
  880.  if local then
  881.   write ('TRUE   ')
  882.  else
  883.   write ('FALSE  ');
  884.  write ('USER: ');
  885.  if thisuser.name = '' then
  886.   write ('UNKNOWN':20)
  887.  else
  888.   write (thisuser.name:20);
  889.  write ('  ',date);
  890.  write (' ',time);
  891.  write ('       ');
  892.  textcolor (7);
  893.  textbackground (0);
  894.  window (1,1,80,24);
  895.  gotoxy (ox,oy);
  896. end;
  897. end.
  898.